<?
//------------------------------------------------------------------------------
//
//       [ GETTING MODULES ]
//
//------------------------------------------------------------------------------


function get_modules()
{
   $db = mysql_init();

   $modules = $db->select("select `keyword` as array_key, `modules`.* from `modules` order by id");

   return $modules;
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


function get_module_rights($mid)
{
   if( !($mid>0 ) ) return false;


   $db = mysql_init();

   $q = "select `keyword` as array_key, `rights`.* from `rights` where module_id=?d order by id";

   $rights = $db->select($q, $mid);

   return $rights;
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


function get_modules_and_rights()
{
   $modules = get_modules();

   foreach($modules as $key => $x)
   {
      $modules[$key]['rights'] = get_module_rights($modules[$key]['id']);
   }

   return $modules;
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------


















?>
